home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 027a / dmpeg10.zip / DMPEG.TXT < prev    next >
Text File  |  1993-04-14  |  12KB  |  327 lines

  1.  
  2.                               DMPEG V1.0
  3.  
  4.                        Public Domain MPEG decoder
  5.  
  6.                            by Stefan Eckart
  7.  
  8.  
  9. 0. Features
  10. ===========
  11.  
  12. DMPEG/DMPLAY is another MPEG decoder/player for the PC:
  13.  
  14.  
  15.  - decodes (nearly) the full MPEG video standard
  16.    (I,P,B frames, frame size up to at least 352x240 supported)
  17.  
  18.  - saves decoded sequence in 8 or 24bit raw file for later display
  19.  
  20.  - optional on-screen display during decoding (requires VGA)
  21.  
  22.  - several dithering options: ordered dither, Floyd-Steinberg, grayscale
  23.  
  24.  - color-space selection
  25.  
  26.  - runs under DOS, 640KB RAM, no MS-Windows required
  27.  
  28.  - very compact (small code / small data models, 16 bit arithmetic)
  29.  
  30.  - real time display of the raw file by a separate player for
  31.    VGA and many Super-VGAs
  32.  
  33.  
  34. 1. Introduction
  35. ===============
  36.  
  37. This program is similar in concept to MPEG386 (a port of the Berkeley player
  38. by Greg Ennis, see appendix) which was posted a while ago. DMPEG, however,
  39. works also for fully fledged MPEG files and is not based on the Berkeley
  40. decoder. It is very compact and somewhat optimized for a 16 bit architecture
  41. but still much slower than the Xing Decoder. Therefore I hesitate to call it
  42. a real-time decoder, although it can decode directly to the screen (and to a
  43. file in parallel). I suggest to use this program in addition to Xing's
  44. MPEG.EXE 320x200 DOS player. The latter is appropriate for real-time display
  45. of '160x120, I-frame only' Xing files, DMPEG is more suitable for larger size
  46. 'real' MPEGs containing I, P and B type, 352x240 sized frames or for faster
  47. and better quality 'off-line' display of the 160x120 MPEGs. Try it on one of
  48. the larger MPEG files (see appendix, my recommendation: flowg.mpg) to see
  49. that MPEG can also be used (and is intended) for storing really sharp,
  50. virtually noise-free sequences.
  51.  
  52. To give an impression of the attainable speeds, here are some figures
  53. measured on a 386DX/33 with 4MB RAM and a Conner 3104 100 MB hard disk. The
  54. decoding time for flowg.mpg (352x240) was about 7 sec per frame, 18 minutes
  55. for 150 frames. waterski.mpg (also 352x240, but lower quality) required
  56. only 3.5 sec per frame. A decoded 150 frame raw data file is 12 MB long and
  57. can be displayed at 5.2 frames/s. 160x120 MPEGs reach 22 frames/s while the
  58. decoding time is 1.9 s/frame. The display frame rate is limited by the
  59. transfer speed from hard disk to memory (about 550 kByte/s on my PC). If you
  60. have enough RAM, you can obtain much higher speed by playing from a large
  61. RAM-disk (e.g 23 frames/s for a 352x240 sequence).
  62.  
  63. This program is Public Domain and I don't take any responsibility regarding
  64. its fitness, usefulness etc. (#include <your_favourite_disclaimer>).
  65. This software is not related to my employment at the Technical University
  66. of Munich. Comments, bug reports, questions to:
  67.  
  68.   Stefan Eckart
  69.   Kagerstr. 4
  70.   W-8000 Muenchen 80
  71.   Germany
  72.  
  73.   email: stefan@lis.e-technik.tu-muenchen.de
  74.  
  75.  
  76. 2. Usage
  77. ========
  78.  
  79.   dmpeg [options] input.mpg [output.raw]
  80.  
  81. input.mpg   any MPEG DIS 11172 compliant non multiplexed compression layer
  82.             stream (D frame streams unsupported)
  83.  
  84. output.raw  the decoded and dithered 8 or 24bit raw output file;
  85.             if omitted: output to screen only
  86.  
  87. Options:
  88.  
  89.  -q     quiet mode; no text output (except error messages)
  90.  -v     verbosity level; can be increased by repeating this option;
  91.         enables display of decoded information (start codes,
  92.         frame size, quantization scales etc.), can't be combined with
  93.         the -s option
  94.  
  95.  -dx    dithering options:
  96.  -d0    ordered, saturation dominant 4x4 dither (default)
  97.  -d1    Floyd-Steinberg error-diffusion / blue-noise-shaping (2 weights)
  98.  -d2    Floyd-Steinberg error-diffusion / blue-noise-shaping (4 weights)
  99.  -d3    undithered grayscale output
  100.  -d4    24 bit true color output
  101.  
  102.  -p0    use full color range palette
  103.  -p1    use restricted color range palette (default)
  104.  
  105.  -s     display the decoded image (or its top left part if larger
  106.         than 320x200) on a standard VGA while decoding
  107.  
  108. Options can be combined. Example:
  109.  
  110.   dmpeg -d2s flowg.mpg flowg.raw
  111.  
  112. decodes MPEG file flowg.mpg to raw file flowg.raw using FS4 dithering and
  113. displaying it on the screen.
  114.  
  115.   dmpeg -vvv flowg.mpg flowg.raw
  116.  
  117. as above but using ordered dither and printing much information on
  118. startcodes, headers and parameters.
  119.  
  120.  
  121. 3. The decoded file player
  122. ==========================
  123.  
  124. This is a rather simple program for transferring the decoded file to the
  125. screen. It currently supports 8 bit files only (no HiColor/TrueColor).
  126.  
  127. Usage:
  128.  
  129.   dmplay [options] input.raw
  130.  
  131. input.raw   the raw date file to be played
  132.  
  133. Options:
  134.  
  135.   -sx   select video driver (x=0..10):
  136.  
  137.   -s0   standard VGA or Super-VGA in 320x200x256 mode (default)
  138.   -s1   VESA
  139.   -s2   ET4000
  140.   -s3   ET3000
  141.   -s4   Video 7
  142.   -s5   Paradise
  143.   -s6   Trident
  144.   -s7   Chips & Technologies
  145.   -s8   ATI
  146.   -s9   Orchid
  147.   -s10  Oaktech
  148.  
  149.   -dn   delay (0..65535, default 0)
  150.  
  151.   -b    8 bit transfer (default: 16 bit)
  152.  
  153. All SVGA drivers use the 640x480x256 display mode and require at least
  154. 512 kB of video memory. If your graphics card is not listed, the
  155. best you can do (besides trying all drivers in the hope that one of
  156. them might work) is to obtain a VESA BIOS extension for your card
  157. and use mode -s1. A collection of such drivers had been posted to
  158. comp.binaries.ibm.pc some two months ago and is also available at
  159. ftp.rahul.net:/pub/bryanw/pc/vesadrv2.zip (anonymous ftp).
  160.  
  161. All drivers except the standard VGA, ET4000 and the VESA driver in
  162. conjunction with the mentioned public domain VESA BIOS extension TSR for the
  163. ET4000 are untested. I'm very interested in email feedback which drivers
  164. work and which don't.
  165.  
  166. The -d option controls playback speed. It is implemented as a simple delay
  167. loop without synchronization to a timer or vertical retrace.
  168.  
  169. The -b option is probably superfluous. I don't have much experience in PC
  170. graphics programming and since I saw some example driver routines using
  171. bytewise transfer (rep movsb) instead of wordwise (rep movsw) I preferred to
  172. include this as a fudge factor. You should try it only in case of problems.
  173. Speed is reduced considerably upon activation of this switch (at least for
  174. cards with 16 bit bus interface).
  175.  
  176. Display can be controlled with the following keys:
  177.  
  178.   any key except
  179.   space, return
  180.   or escape       halt display at current frame and step one frame forward
  181.                   each time a key is pressed
  182.  
  183.   space           step one frame backwards
  184.  
  185.   return          continue display
  186.  
  187.   escape          quit program
  188.  
  189.  
  190. 4. Technical information
  191. ========================
  192.  
  193. The player is a rather straightforward implementation of the MPEG spec [1].
  194. The IDCT is based on the Chen-Wang 13 multiplication algorithm [2]
  195. (not quite the optimum, I know). Blocks with not more than eight non-zero
  196. coefficients use a non-separated direct multiply-accumulate 2D-IDCT
  197. (sounds great, doesn't it?), which turned out to be faster than a 'fast'
  198. algorithm in this (quite common) case. Dithering is pretty standard. Main
  199. difference to the Berkeley decoder (except for the fewer number of supported
  200. algorithms) is the use of 256 instead of 128 colors, the (default) option to
  201. use a restricted color-space and the implementation of a color saturation
  202. dominant ordered dither. This leads to a significantly superior quality of
  203. the dithered image (I claim, judge yourself).
  204.  
  205. Restricted color-space means that the U and V components are clipped to
  206. +/-0.25 (instead of +/-0.5) and the display color-space points are distributed
  207. over this restricted space. Since the distance between color-space points
  208. is thus reduced by a factor of two, the color resolution is doubled at the
  209. expense of not being able to represent fully saturated colors.
  210.  
  211. Saturation dominant ordered dither is a method by which a color, lying
  212. somewhere between the points of the display color space, is approximated
  213. by primarily alternating between two points of constant hue instead of
  214. constant saturation. This yields subjectivly better quality due to the
  215. lower sensitivity of the human viewing system to saturation changes than
  216. to hue changes (the same reasoning as used by the PAL TV standard to improve
  217. on NTSC). The improvement is particularly visible in dark brown or redish
  218. areas.
  219.  
  220.  
  221. 5. File formats
  222. ===============
  223.  
  224. If you want to write your own player or to post-process the results, here is
  225. the format of the 8 bit raw file:
  226.  
  227. Byte
  228.  
  229. 0..7      compatibility bytes (to be ignored)
  230. 8..9      image width  (MSB first)
  231. 10..11    image height (MSB first)
  232. 12..31    compatibility / unused
  233. 32..799   color table, R[0],G[0],B[0],  ... R[255],G[255],B[255]
  234. 800..     image data in natural order (top left to bottom right,
  235.           all frames concatenated without any gaps or repeated
  236.           headers)
  237.  
  238. The format of 24bit true color files (-d4 option) is:
  239.  
  240. 0..7      compatibility bytes (to be ignored)
  241. 8..9      image width  (MSB first)
  242. 10..11    image height (MSB first)
  243. 12..31    compatibility / unused
  244. 32..      image data (3 bytes per pixel: R,G,B, top left to bottom right,
  245.           all frames concatenated without any gaps or repeated
  246.           headers)
  247.  
  248. These formats happen to be compatible with the raw format used by a shareware
  249. program called Image Alchemy. In fact you can use that program to view the
  250. first frame of the sequence and to convert it into other formats.
  251.  
  252.  
  253. 6. Future
  254. =========
  255.  
  256. Obviously this program is still in its early infancy with many improvements
  257. to be done. I assume it to be relatively bug-free in the MPEG part, at least
  258. it decodes all the MPEG scenes I could get hold of up to now (note that some
  259. of the MPEGs at toe.cs.berkeley.edu seem to contain errors, e.g. bicycle.mpg,
  260. which show up both on the Berkeley decoder and on DMPEG).
  261.  
  262. Some improvements which come into mind: speed-up, better graphic support
  263. (Hi/TrueColor), better user interface, other output formats.
  264. I hope to be able to include some of these points into a new release.
  265.  
  266.  
  267. 7. References
  268. =============
  269.  
  270. 1. Coding of moving pictures and associated audio for digital storage
  271.    media up to about 1,5 Mbit/s, Draft International Standard ISO/IEC
  272.    DIS 11172, 1992.
  273.  
  274. 2. Chen, Wang, IEEE ASSP-32, pp. 803-816, Aug. 1984.
  275.  
  276.  
  277. Appendix A: Related Software
  278. ============================
  279.  
  280. This list is probably incomplete, but it's all I'm aware of. Of course
  281. there are programs for other systems as well (Mac, Amiga etc.).
  282.  
  283. mpeg_play      MPEG Video Software Decoder (Version 2.0; Jan 27, 1993)
  284.                Authors: Lawrence A. Rowe, Ketan Patel, and Brian Smith
  285.                Computer Science Division-EECS, Univ. of Calif. at Berkeley
  286.                toe.cs.berkeley.edu:/pub/multimedia/mpeg/mpeg-2.0.tar.Z
  287.  
  288. mpgplay        Online port of mpeg_play for DOS
  289.                by: Giampero Caprino, scompx@milano.oas.olivetti.com
  290.                (evaluation version, works only with Xing files)
  291. mpeg386.exe    Offline port of mpeg_play for DOS
  292.                by: Greg Ennis, 93gke@cs.williams.edu
  293.                (based on mpgplay, works only with Xing files)
  294. mpegwin        Online port of mpeg_play for MS-Windows
  295.                by: Michael Simmons, msimmons@ecel.uwa.edu.au
  296.                toe.cs.berkeley.edu:/pub/multimedia/mpeg/Ports/mpegw32.tar.Z
  297.                (HiColor & TrueColor support, Shareware)
  298.  
  299. mplay.exe,
  300. mpeg.exe       DOS MPEG players from Xing Technologies
  301.                (very high speed, but decodes only a small subset of the
  302.                 MPEG standard)
  303. ?              a variety of MS-Windows MPEG players from Xing Technologies
  304.                (sorry I lost the overview...)
  305.  
  306. MPEGv1.1       MPEG Software Encoder
  307.                Authors: Portable Video Research Group
  308.                havefun.stanford.edu:/pub/mpeg/MPEGv1.1.tar.Z
  309.  
  310.  
  311. APPENDIX B: MPEG files
  312. ======================
  313.  
  314. Two good sources for MPEG files:
  315.  
  316.   toe.cs.berkeley.edu:/pub/multimedia/mpeg/movies
  317.   havefun.stanford.edu:/pub/mpeg
  318.  
  319. High quality MPEGs you simply can't afford to miss:
  320.  
  321.   tennis.mpg
  322.   flowg.mpg
  323.   bike.mpg
  324.  
  325. -- 
  326. Stefan Eckart, stefan@lis.e-technik.tu-muenchen.de, April 1993.
  327.